package com.jsbs.iam.user.service.impl;

import com.jsbs.iam.user.entity.IamAdminRoleOrgInfo;
import com.jsbs.iam.user.mapper.AdminRoleMapper;
import com.jsbs.iam.user.service.AdminRoleService;
import com.jsbs.iam.user.vo.AdminRoleVo;
import com.jsbs.iam.user.vo.IamAdminRoleApplyInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @BelongsProject: iam
 * @BelongsPackage: com.jsbs.iam.user.service.impl
 * @Author: WangJiYuan
 * @Description: TODO
 * @Version: 2023-01-18  11:25
 */
@Service
public class AdminRoleServiceImpl implements AdminRoleService {

    @Autowired
    private AdminRoleMapper adminRoleMapper;

    @Override
    public AdminRoleVo queryAdminRole(String roleCode, String companyCode) {
        AdminRoleVo adminRole = new AdminRoleVo();
        //根据角色查询组织权限
        List<IamAdminRoleOrgInfo> orgRoleList=adminRoleMapper.getAdminRoleOrgInfo(roleCode, companyCode);
        //根据角色查询应用权限
        List<IamAdminRoleApplyInfoVo> applyRoleList=adminRoleMapper.getAdminRoleApplyInfo(roleCode, companyCode);
        adminRole.setAdminRoleCode(roleCode);
        adminRole.setOrgRoleList(orgRoleList);
        adminRole.setApplyRoleList(applyRoleList);
        return adminRole;
    }
}
